Skip to content

Conversation

@jparraga-stackav
Copy link

@jparraga-stackav jparraga-stackav commented Apr 19, 2025

What type of PR is this?

New feature

What this PR does / why we need it:

This pull request add support for native Armada Preemption Retry Handling. Retry handling can be configured at the platform level as a default in the scheduling config as well as with two annotations:

  1. armadaproject.io/preemptionRetryCountMax (defaults to 0 for now, ie. disabled if not configured)
  2. armadaproject.io/preemptionRetryEnabled

The scheduling algorithm has been modified to not fail jobs that are preempted if they are eligible for a retry. If the job is eligible to be retried it will be marked to be requeued.

Unit tests are included. We've also tested this end to end in our development environment with jobs/gangs and combinations of successful retries as well as exhausting retries.

Screenshot 2025-04-15 at 7 09 04 PM

Which issue(s) this PR fixes:

Fixes: #4340

Special notes for your reviewer:

@jparraga-stackav jparraga-stackav marked this pull request as ready for review April 19, 2025 00:08

// AreRetriesEnabled determines whether preemption retries are enabled at the job level. Also returns whether the
// annotation was set.
func AreRetriesEnabled(annotations map[string]string) (bool, bool) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd name the return params, so it is easier to see what is what

@d80tb7
Copy link
Collaborator

d80tb7 commented Apr 29, 2025

Hi,

thanks for this- it looks great. One thing I think we should consider/discuss is whether we could add the preemption retry fields as first-class proto fields rather than relying on annotations. Reasoning here is that anottions are very easy to add at first as they require no interface changes, but can soone get quite hard to work with as evwerything is just a map[string]string.

Personally I'd be in favour of adding these fields to schedulerobjects.JobSchedulingInfo right now with the view of adding them to api.Job once the feature is stable.

One comment I

@jparraga-stackav
Copy link
Author

Personally I'd be in favour of adding these fields to schedulerobjects.JobSchedulingInfo right now with the view of adding them to api.Job once the feature is stable.

I looked into this but it seems a bit difficult to keep it is an annotation and not a first class citizen.

I'm not able to create the scheduling info from an armadaevents.SubmitJob since the annotations aren't there. I think there would also need to be some more thinking about how the global preemption retry config integrates into this. Might need to move that into the scheduler ingester to more elegantly handle that unless we want to reference the global preemption retry config all the time.

@Cinojose
Copy link

Cinojose commented May 9, 2025

@jparraga-stackav Thanks for the work on this.
I was wondering if we could also handle imminent node shutdown scenarios. In addition to the current retry logic for pod evictions, it might be useful to check for pods terminated with the reason:

Pod was terminated in response to imminent node shutdown.

We could incorporate a simple check on pod.Status.Message to capture these cases. This would help cover both graceful shutdowns and node preemptions for various reasons.

@jparraga-stackav
Copy link
Author

@jparraga-stackav Thanks for the work on this. I was wondering if we could also handle imminent node shutdown scenarios. In addition to the current retry logic for pod evictions, it might be useful to check for pods terminated with the reason:

Pod was terminated in response to imminent node shutdown.

We could incorporate a simple check on pod.Status.Message to capture these cases. This would help cover both graceful shutdowns and node preemptions for various reasons.

I will likely look into this as a follow up improvement.

@jparraga-stackav jparraga-stackav force-pushed the preemption-retries branch 2 times, most recently from 75306bd to dbd0cef Compare May 28, 2025 00:27
Signed-off-by: Jason Parraga <[email protected]>
@@ -1 +1 @@
ALTER TABLE runs ADD COLUMN IF NOT EXISTS run_index bigint NOT NULL DEFAULT 0;
ALTER TABLE runs ADD COLUMN IF NOT EXISTS run_index bigint;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During testing we found that the old scheduler ingester was trying to write rows with a null value which blocked ingestion from occurring. In order to make this smoother we've made this null-able and then handle null-able values in the app layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native support for preemption retries

5 participants